/**
 * 
 */
package com.kelaite.procurement.constants;

import com.kelaite.procurement.exception.BusinessException;

/**
 * @author yuanchangwei
 *
 */
public enum BidTypeEnum {

	INVITE_BIDS(1, "招标"), GRANT(2, "授予"), BID_NEGOTIATION(3, "议标"), BID_XUNJIA(4, "询价");

	private int val;
	private String desc;

	public int getVal() {
		return val;
	}

	public void setVal(int val) {
		this.val = val;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	private BidTypeEnum(int val, String desc) {
		this.val = val;
		this.desc = desc;
	}

	public static BidTypeEnum transFromVal(int val) {
		for (BidTypeEnum entity : values()) {
			if (val == entity.getVal()) {
				return entity;
			}
		}
		throw new BusinessException(String.format(
				"bidType value[%s] is not in[1, 2, 3]", val));
	}
}
